﻿using System.Collections.Generic;
using Journal.Common.Models;
using Journal.Common.Objects;
using Journal.Common.Objects.Column;
using Journal.Common.Objects.Enums;
using Journal.Domain.Models;
using Journal.Front.Presentation.Models.BaseModels;
using Journal.Resources;

namespace Journal.Front.Presentation.Models.StudentModels.Items
{
    public class StudentSelectModelItem : BaseSelectItemModel
    {
        public StudentSelectModelItem(User user, UrlModel urlModel, int groupId)
        {
            Id = user.Id;
            Items = new List<IBaseColumn>()
                        {
                            new StringColumn(string.Concat(user.UserInfo.Name, user.UserInfo.Surname)),
                            new ListControlsColumn(new List<IBaseColumn>()
                            {
                                new ButtonColumn(HtmlControlsTitles.EditLink, new {@class = "popup-button"})
                                    { 
                                        DataParams = new Dictionary<string, string>(){{"popup-url", urlModel.GetUrl(UrlType.Edit, new { groupId, studentId = user.Id })}}
                                    },
                                 new ButtonColumn(HtmlControlsTitles.DeleteLink)
                                    { 
                                        DataParams = new Dictionary<string, string>(){{"delete-url", urlModel.GetUrl(UrlType.Delete, new { groupId, studentId = user.Id })}}
                                    },
                            })
                        };
        }
    }
}